<template>
  <div class="customerDetail">
    <el-divider></el-divider>
    <span style="margin-right: 10px">代理商简称：</span>
    <span style="margin-left: 10px">{{ customer.username }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">行业：</span>
    <span style="margin-left: 10px">{{ customer.industry }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">简介：</span>
    <span style="margin-left: 10px">{{ customer.description }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">公司名称：</span>
    <span style="margin-left: 10px">{{ customer.companyName }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">联系人：</span>
    <span style="margin-left: 10px">{{ customer.contactPerson }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">手机号：</span>
    <span style="margin-left: 10px">{{ customer.phoneNumber }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">qq号：</span>
    <span style="margin-left: 10px">{{ customer.qq }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">微信号：</span>
    <span style="margin-left: 10px">{{ customer.wechat }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">上架短视频数：</span>
    <span style="margin-left: 10px">{{ customer.videoCount }}</span>
    <el-divider></el-divider>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
import {getUserOfId} from '../api/index'

export default {
  name: 'CustomerDetail',
  data() {
    return {
      customer: {
        id: null,
        username: null,
        industry: null,
        description: null,
        companyName: null,
        contactPerson: null,
        phoneNumber: null,
        qq: null,
        wechat: null,
        videoCount: null
      }
    }
  },
  computed: {
    ...mapGetters([
      'userId'
    ])
  },
  mounted() {
    if (this.userId) {
      this.getMsg(this.userId)
    }

  },
  methods: {
    getMsg(id) {
      getUserOfId(id)
        .then(res => {
          this.customer.id = res.data.id
          this.customer.username = res.data.username
          this.customer.industry = res.data.industry
          this.customer.description = res.data.description
          this.customer.companyName = res.data.companyName
          this.customer.contactPerson = res.data.contactPerson
          this.customer.phoneNumber = res.data.phoneNumber
          this.customer.qq = res.data.qq
          this.customer.wechat = res.data.wechat
          this.customer.videoCount = res.data.videoCount
        })
        .catch(err => {
          console.log(err)
        })
    },
  }
}
</script>

<style scoped>

</style>
